package com.ziq.zcamp.mine

import android.content.Context
import android.content.Intent
import com.ziq.base.base.BaseActivity
import com.ziq.zcamp.manager.GlobalContextManager
import dagger.hilt.android.AndroidEntryPoint


@AndroidEntryPoint
class MyOrderActivity : BaseActivity() {

    companion object {
        const val TARGET_TAB_INDEX = "tab_index"
        const val GO_ACTIVITY = "is_activity"
        const val TARGET_TAB_ALL = 0
        const val TARGET_TAB_UNPAID = 1
        const val TARGET_TAB_WAIT_ACCEPT = 2
        const val TARGET_TAB_UNUSED = 3
        const val TARGET_TAB_REFUND = 4

        private const val TITLE_ALL = "全部"
        private const val TITLE_UNPAID = "待付款"
        private const val TITLE_WAIT_ACCEPT = "待接单"
        private const val TITLE_UNUSED = "待消费"
        private const val TITLE_REFUND = "退款"
        private const val TITLE_CONFIRM = "待确认"
        private const val TITLE_PARTICIPATE_ = "待参加"

        val titles = listOf(TITLE_ALL, TITLE_UNPAID, TITLE_WAIT_ACCEPT, TITLE_UNUSED, TITLE_REFUND)
        val actTitles = listOf(TITLE_ALL, TITLE_UNPAID, TITLE_CONFIRM, TITLE_PARTICIPATE_, TITLE_REFUND)
        private val idToIndexMap = mapOf(
            Pair(TARGET_TAB_ALL, 0),
            Pair(TARGET_TAB_UNPAID, 1),
            Pair(TARGET_TAB_WAIT_ACCEPT, 2),
            Pair(TARGET_TAB_UNUSED, 3),
            Pair(TARGET_TAB_REFUND, 4),
        )
        private val IndexToTypeMap = listOf(TARGET_TAB_ALL,TARGET_TAB_UNPAID,TARGET_TAB_WAIT_ACCEPT,TARGET_TAB_UNUSED,TARGET_TAB_REFUND)
        fun open(context: Context, id: Int , isActivity : Boolean = false){
            val intent = Intent(context, MyOrderActivity::class.java)
            intent.putExtra(TARGET_TAB_INDEX, idToIndexMap[id]?:0)
            intent.putExtra(GO_ACTIVITY,isActivity)
            GlobalContextManager.startActivity(context, intent)
        }
    }
}